package cn.person.weichangjie.crawler.webmagic.service;

import java.util.Map;

import org.springframework.stereotype.Repository;

import com.jayway.jsonpath.spi.json.GsonJsonProvider;

import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;
import us.codecraft.webmagic.pipeline.Pipeline;

/**
 * 入库模块 : 持久化爬虫数据
 * @author weichangjie
 */
@Repository
public class PipelineService implements Pipeline {

	@Override
	public void process(ResultItems resultItems, Task task) {
		for (Map.Entry<String, Object> entry : resultItems.getAll().entrySet()) {
			System.out.println(">>>>>>" + new GsonJsonProvider().toJson(entry));
		}
	}
}
